const app = getApp(); // 获取全局应用实例
const baseURL = app.globalData.baseURL

export const requestA = (url, method = {}) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${baseURL}${url}`,
      method: method,
      // params,
      success: (res) => {
        if (res.statusCode >= 200 && res.statusCode < 300) {
          resolve(res.data)
        } else {
          reject(res.data)
        }
      },
      fail: (err) => reject(err)
    })
  })
}